﻿#include <vector>
#include <iostream>

using namespace std;

int main(int argc, char** argv){
	if(argc != 2){
		cout << "Enter a argument." << endl;
		system("PAUSE");
		return 0;
	}
	string name = argv[1];
	cout << "argv: " << argv[1] << endl;

	int index = -1;
	for(int i=0; i<name.size(); i++){
		if(name[i] == '/' || name[i] == '\\'){
			index = i;
		}
	}
	//cout << "Position of last '/' is at " << index << endl;
	char path[80];
	unsigned int length = name.copy(path, index+1, 0);
	path[length] = '\0';
	//cout << "Path: " << path << endl;

	//int index = -1;
	//for(int i=0; i<strlen(name); i++){
	//	if(name[i] == '/' || name[i] == '\\'){
	//		cout << i << endl;
	//		index = i;
	//	}
	//}

	//cout << "Position of last '/' is at " << index << endl;



	//char* path = strtok(name, "\\/");

	//vector<char*> holder;
	//while(path!=NULL){
	//	cout << "Out: " << path << endl;
	//	holder.push_back(path);
	//	path = strtok(NULL, "\\/");
	//}

	//char fullPath[80];
	//strcpy(fullPath, holder[0]);
	//for(int i=1; i<holder.size(); i++){
	//	strcat(fullPath, holder[i]);
	//}
	//cout << "Fullpath: " << fullPath << endl;


	system("PAUSE");
	return 0;
}